# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/topics/item-pipeline.html
import smtplib
from email.mime.text import MIMEText


class WpezPipeline(object):
    def process_item(self, item, spider):
        return item

class HitPipeline(object):
    def process_item(self, item, spider):
        msg = MIMEText('test email')
        msg['Subject'] = 'Hi, price is low!'
        msg['From'] = 'noreply@yue.in'
        msg['To'] = 'yanweiping@chinahr.com'
        try:
            s = smtplib.SMTP('smtp.126.com')
            s.login('qqtestmail@126.com', 'qqtest123$')
            s.sendmail('qqtestmail@126.com', 'yanweiping@chinahr.com', msg.as_string())
            s.quit()
        except Exception, e:
            print str(e)
        return item

